package com.qs.education.service.impl;

import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.qs.education.bean.api.ResponseListBean;
import com.qs.education.bean.beans.EducationSubjectBean;
import com.qs.education.bean.entity.EducationSubject;
import com.qs.education.bean.service.BaseService;
import com.qs.education.service.ISubjectAPIService;

@Service
public class SubjectAPIServiceImpl extends BaseService implements ISubjectAPIService {

	@Override

	public ResponseListBean<EducationSubjectBean> getEducationSubjectList() {
		
		List<EducationSubject> list = iEducationSubjectDao.getAll(EducationSubject.class); 
		ResponseListBean<EducationSubjectBean> response = new ResponseListBean<EducationSubjectBean>();
		for(EducationSubject subject : list) {
			if(subject!= null) {
				EducationSubjectBean educationSubjectBean = new EducationSubjectBean();
				BeanUtils.copyProperties(subject, educationSubjectBean);
				response.getList().add(educationSubjectBean);
			}
		}
		return response;
	}

}
